import logging

def get_numlines(filename):
	'''Gets the number of lines in the file indicated by filename.'''
	try:
		with open(filename, 'r') as f:
			return len(f.readlines())
	except EnvironmentError as e:
		print e.message
		logging.error(e)
	except TypeError as e:
		print e.message
		logging.error(e)

print get_numlines("blah")
